package com;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class JDBC_05_PreparedStatement {

	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/day_03", "root", "root");
		PreparedStatement preparedStatement = connection
				.prepareStatement("insert into t_user (username,password,nickname) values (?,?,?)");
		preparedStatement.setString(1, "张三");
		preparedStatement.setString(2, "root");
		preparedStatement.setString(3, "xxxx");

		int count = preparedStatement.executeUpdate();
		System.out.println("影响了 " + count);
	}

}
